<?php
    $customerid = $_SESSION['customerid'];

    switch ($change_new)
        {
            case 'Deutsch':$sql5= "update settings set learn='Deutsch', learnde='Deutsch', learnen='German', learnes='Alemán', learnru='Немецкий' where customerid = ". $customerid;break;
            case 'Englisch':$sql5= "update settings set learn='Englisch', learnde='Englisch', learnen='English', learnes='Inglés', learnru='Английский' where customerid = ". $customerid;break;
            case 'Spanisch':$sql5= "update settings set learn='Spanisch', learnde='Spanisch', learnen='Spanish', learnes='Español', learnru='Испанский' where customerid = ". $customerid;break;
            case 'Russisch':$sql5= "update settings set learn='Russisch', learnde='Russisch', learnen='Russian', learnes='Ruso', learnru='Русский' where customerid = ". $customerid;
        }

    $db_sel5 = mysql_query( $sql5 );
    if ( ! $db_sel5 ) { die('Error query4: ' . mysql_error()); }

    // check, if oldlanguage = newlanguage
	$sql7 = " select cande from settings ";
    $sql7 .= " where customerid = ". $customerid;
    $db_sel7 = mysql_query( $sql7 );
    if ( ! $db_sel7 ) { die('Error query7: ' . mysql_error()); }
    while ($row = mysql_fetch_array( $db_sel7, MYSQL_ASSOC)) {
    $can = $row['cande'];
    if ( $row['cande'] == $change_new )
    {
        $can = '-';
        // update language can
	    $sql9 = " update settings set ";
        $sql9 .= " can = '-', cande = '-', canen = '-', canes = '-', canru = '-', langpair = ''  ";
        $sql9 .= " where customerid = ". $customerid;
        $db_sel9 = mysql_query( $sql9 );
        if ( ! $db_sel9 ) { die('Error query9: ' . mysql_error()); }
    }
    }

    // update langpair
	$sql11 = " select langpairid from langpairs_german ";
    $sql11 .= " where can = '". $can . "' and learn = '". $change_new . "' ";
    $db_sel11 = mysql_query( $sql11 );
    if ( ! $db_sel11 ) { die('Error query7: ' . mysql_error()); }
    while ($row = mysql_fetch_array( $db_sel11, MYSQL_ASSOC)) {

	$sql12 = " update settings set ";
    $sql12 .= " langpair = ". $row['langpairid'];
    $sql12 .= " where customerid = ". $customerid;

    $db_sel12 = mysql_query( $sql12 );
    if ( ! $db_sel12 ) { die('Error query4: ' . mysql_error()); }
    $_SESSION['langpair'] = $row['langpairid'];
    }






?>